import { createRouter, createWebHashHistory } from 'vue-router' 
const globalRoutes = [
  { path: '/404', component: ()=>import('@/views/common/404.vue'), name: '404', meta: { title: '404未找到' } },
  { path: '/login', component: ()=>import('@/views/common/login.vue'), name: 'login', meta: { title: '登录' } }, 
]
const mainRoutes = {
  path: '/',
  component: ()=>import('@/views/main.vue'),
  name: 'main',
  redirect: { name: 'home' },
  meta: { title: '主入口整体布局' },
  children: [ 
    { path: '/home', component: import('@/views/common/home.vue'), name: 'home', meta: { title: '首页',isTab:true ,isTabClose:false} }, 
  ],
}
const router = createRouter({
  history: createWebHashHistory(),
  routes: globalRoutes.concat(mainRoutes)
})

// 添加路由监控
router.beforeEach((to, from, next) => {
  // 在这里可以添加路由监控的逻辑
  console.log('Navigating from', from.path, 'to', to.path);
  next(); // 继续导航
})

export default router